<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>评论展示页</title>
        <link rel="stylesheet" href="../../static/layui/css/layui.css" />
        <link rel="stylesheet" href="../../static/css/yx.css" />
        <script src="../../static/js/jquery-2.1.4.min.js" ></script>
        <script type="text/javascript" src="../../static/layui/layui.all.js" ></script>
        <script src="../../static/js/yx.js" >/*公共js*/</script>
        <style type="text/css">
        	
        	body{background-color: #fff;}
        	.cthh{line-height: 2em; text-indent: 1em;margin-top: 0.8em;}
        	
        	.cts_tab{padding: 0em 1em;}
        	.layui-tab-title li{padding:0px;}
        	
        	.ct{
        		font-size: 1.4rem;
				margin-bottom: 0.5em;
				padding: 1em 2em 0em 2em;
			}
			
			/* 页眉 */
			.page-head{border: 0px #000 solid;position: relative;}
			.page-head img{width: 5rem;height: 5rem;border-radius: 50%;}
			.puname{font-size: 1.1em;position: relative;top: 3px;margin: auto 0.2em;}
			.ptime{color: #666;margin-left: 1em;}
			.p-next{position: absolute;right: 0.5em;top: 0.5em;width:2em;line-height: 2em;text-align: center;}
			
			/* 页身体 */
			.phh{margin: 0.7em 0px;}
			.ptext{border: 0px #000 solid;max-height: 40em;overflow: hidden;margin-top: 0.5em;}
			
			/* 页脚 */
			.page-foot{line-height: 3rem;margin:0.2em 0em;color: #333;border-bottom: 1px #DDD solid;}
			.page-foot span{padding-right: 0.5em;display: inline-block;}
			.page-foot i{font-size: 1.3em; position: relative;top: 2px;}
			
			.fenyefox{margin: 1em 1.5em 0em 1.5em;}
			.fenyefox *{border-radius: 0px !important;clear: both;}
        	#fenye span{background-color: rgba(0,0,0,0);color: #000;}
        	
        	
        	
        </style>
        <script type="text/javascript">
        	
        	var pid="${pid}";
        	var way="${way}";
			var shua = function(way, pn, pz) {
				way = way == undefined ? 1 : way;
				pn = pn == undefined ? 0 : pn;
				pz = pz == undefined ? 0 : pz;
				location.href = "rct.html?pid=" + pid + "&way=" + way + "&pn=" + pn + "&pz=" + pz;
			}
        	
        	$(function() {

				
				//分页
				var laypage = layui.laypage;
				laypage.render({
					elem:'fenye',
					count:"${page.count}",
					curr:"${page.pn}",
					limits:[5,10,15,20],
					limit:"10",
				    first: false,
				    last: false,
				    groups:1,
					layout: [ 'prev', 'page', 'next'],
					theme: '#098',
					jump: function(obj,first) {
						if(!first){
							shua(pid,obj.curr,obj.limit);
						}
					}
				});
				
        		
        		//下滑线醒目
        		$(".layui-tab-title li").each(function(i){
        			if(i+1==way){
        				$(this).addClass('layui-this');
        			}
        		})
        		
        		
        		//点赞
        		$(".czan").click(function(){
        			
        			tiaodong($(this));
        			var $ts=$(this);
	
					var cid=$(this).parent().children("[name=cid]").val();
					$.post2("../ct/doCtZan.ajax",{cid:cid},function(data){
	
						if(data.res==-2){top.layer.msg("重复点赞");}
						if(data.res==1){
							domAddX($ts.children(".num").get(0),1);
							$ts.css("color","red");
						}
					},function(e,ee,eee){
						top.layer.msg("请求失败"+eee);
					})
        			
        			
        		})
        		
        		
				//父类窗口
        		var h=$('body').height();
        		parent.window.setheight(h);
        		
        	})
        </script>
    </head>
    <body>
    	
    	<h3 class="cthh yx-color-one">评论</h3>
    	
    	<div class="cts_tab layui-tab-brief layui-tab">
			<ul id="ss" class="layui-tab-brief layui-tab-title">
				<li onclick="shua(1)">点赞</li>
				<li onclick="shua(2)">顺序</li>
				<li onclick="shua(3)">最新</li>
			</ul>
				
		</div> 
    	
    	<c:forEach items="${for_cts}" var="ct" >
    		<div class="ct">
		
				<!-- 页眉 -->
				<div class="page-head">
					<input type="hidden" name="cid" value="${ct.cid}" />
					<a href="../user/rus.html?uid=${ct.uid}" target="_top">
						<img src="../../static/tu/${ct.uid}/tou.png"/>
						<span class="puname yx-hover-red yx-color-one">${ct.uname}</span>
						<span class="ptx layui-badge layui-bg-blue usee_tx">${ct.ujf}</span>
						<span class="ptime yx-oneline">${ct.c_time}</span>
						
					</a>
					&nbsp;&nbsp;&nbsp;
					<span class="czan yx-hover-red"><i class="layui-icon">&#xe6c6;</i> <span class="num">${ct.c_zan}</span></span>
				</div>
				
				<!-- 正文 -->
				<div class="ptext ptextstyle">
					${ct.c_text}
				</div>
				
				<!-- 页脚 -->
				<div class="page-foot yx-hover-zi-red">
					
					<!-- 是否似曾相识？v1.0中的一句话：记住这个耻辱！控制不了架构就只能阉割功能 -->
					<!-- 希望你记住：架构未完休动刀 -->
					<!--<span class="pread"><i class="layui-icon">&#xe63a;</i> <span>${ct.c_ctnum}</span></span>-->
				</div>
				
			</div>
    	</c:forEach>
    	
    	<div class="fenyefox">
			<div id="fenye"> <!-- 牛逼的分页 哈哈 --> </div>
		</div>
    	
    	
    	
    	
 	</body>
</html>